%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/dynamic-json"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 8, 9, 48, 56, 64, 72, 80, 88, 96, 117, 118, 119, 120, 121, 10, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99<br />2: 7, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 106<br />3: 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 108<br />ᐳ: 12, 14, 15, 20, 22, 23, 28, 30, 31, 36, 38, 39, 44, 46, 47, 52, 54, 55, 60, 62, 63, 68, 70, 71, 76, 78, 79, 84, 86, 87, 92, 94, 95, 100, 102, 103<br />4: ConnectionItems[110]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 108, 110<br /><br />ROOT Connectionᐸ106ᐳ[108]"):::bucket
    Bucket3("Bucket 3 (listItem)<br /><br />ROOT __Item{3}ᐸ110ᐳ[113]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 114<br /><br />ROOT PgSelectSingle{3}ᐸtypesᐳ[114]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket3
    Bucket3 --> Bucket4

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgFromExpression11{{"PgFromExpression[11∈0] ➊<br />More deps:<br />- Constantᐸtrueᐳ[117]"}}:::plan
    Object10 & PgFromExpression11 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    PgSelect17[["PgSelect[17∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression19{{"PgFromExpression[19∈0] ➊<br />More deps:<br />- Constantᐸfalseᐳ[118]"}}:::plan
    Object10 & PgFromExpression19 --> PgSelect17
    PgSelect25[["PgSelect[25∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression27{{"PgFromExpression[27∈0] ➊<br />More deps:<br />- Constantᐸ42ᐳ[119]"}}:::plan
    Object10 & PgFromExpression27 --> PgSelect25
    PgSelect33[["PgSelect[33∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression35{{"PgFromExpression[35∈0] ➊<br />More deps:<br />- Constantᐸ3.1415ᐳ[120]"}}:::plan
    Object10 & PgFromExpression35 --> PgSelect33
    PgSelect41[["PgSelect[41∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression43{{"PgFromExpression[43∈0] ➊<br />More deps:<br />- Constantᐸ'hello, world!'ᐳ[121]"}}:::plan
    Object10 & PgFromExpression43 --> PgSelect41
    PgSelect49[["PgSelect[49∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression51{{"PgFromExpression[51∈0] ➊"}}:::plan
    Object10 & PgFromExpression51 --> PgSelect49
    PgSelect57[["PgSelect[57∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression59{{"PgFromExpression[59∈0] ➊"}}:::plan
    Object10 & PgFromExpression59 --> PgSelect57
    PgSelect65[["PgSelect[65∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression67{{"PgFromExpression[67∈0] ➊"}}:::plan
    Object10 & PgFromExpression67 --> PgSelect65
    PgSelect73[["PgSelect[73∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression75{{"PgFromExpression[75∈0] ➊"}}:::plan
    Object10 & PgFromExpression75 --> PgSelect73
    PgSelect81[["PgSelect[81∈0] ➊<br />ᐸjson_identityᐳ"]]:::plan
    PgFromExpression83{{"PgFromExpression[83∈0] ➊"}}:::plan
    Object10 & PgFromExpression83 --> PgSelect81
    PgSelect89[["PgSelect[89∈0] ➊<br />ᐸjsonb_identityᐳ"]]:::plan
    PgFromExpression91{{"PgFromExpression[91∈0] ➊"}}:::plan
    Object10 & PgFromExpression91 --> PgSelect89
    PgSelect97[["PgSelect[97∈0] ➊<br />ᐸjsonb_identityᐳ"]]:::plan
    PgFromExpression99{{"PgFromExpression[99∈0] ➊"}}:::plan
    Object10 & PgFromExpression99 --> PgSelect97
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    First12{{"First[12∈0] ➊"}}:::plan
    PgSelectRows13[["PgSelectRows[13∈0] ➊"]]:::plan
    PgSelectRows13 --> First12
    PgSelect7 --> PgSelectRows13
    PgSelectSingle14{{"PgSelectSingle[14∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First12 --> PgSelectSingle14
    First20{{"First[20∈0] ➊"}}:::plan
    PgSelectRows21[["PgSelectRows[21∈0] ➊"]]:::plan
    PgSelectRows21 --> First20
    PgSelect17 --> PgSelectRows21
    PgSelectSingle22{{"PgSelectSingle[22∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First20 --> PgSelectSingle22
    First28{{"First[28∈0] ➊"}}:::plan
    PgSelectRows29[["PgSelectRows[29∈0] ➊"]]:::plan
    PgSelectRows29 --> First28
    PgSelect25 --> PgSelectRows29
    PgSelectSingle30{{"PgSelectSingle[30∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First28 --> PgSelectSingle30
    First36{{"First[36∈0] ➊"}}:::plan
    PgSelectRows37[["PgSelectRows[37∈0] ➊"]]:::plan
    PgSelectRows37 --> First36
    PgSelect33 --> PgSelectRows37
    PgSelectSingle38{{"PgSelectSingle[38∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First36 --> PgSelectSingle38
    First44{{"First[44∈0] ➊"}}:::plan
    PgSelectRows45[["PgSelectRows[45∈0] ➊"]]:::plan
    PgSelectRows45 --> First44
    PgSelect41 --> PgSelectRows45
    PgSelectSingle46{{"PgSelectSingle[46∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First44 --> PgSelectSingle46
    __InputDynamicScalar48{{"__InputDynamicScalar[48∈0] ➊"}}:::plan
    __InputDynamicScalar48 --> PgFromExpression51
    First52{{"First[52∈0] ➊"}}:::plan
    PgSelectRows53[["PgSelectRows[53∈0] ➊"]]:::plan
    PgSelectRows53 --> First52
    PgSelect49 --> PgSelectRows53
    PgSelectSingle54{{"PgSelectSingle[54∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First52 --> PgSelectSingle54
    __InputDynamicScalar56{{"__InputDynamicScalar[56∈0] ➊"}}:::plan
    __InputDynamicScalar56 --> PgFromExpression59
    First60{{"First[60∈0] ➊"}}:::plan
    PgSelectRows61[["PgSelectRows[61∈0] ➊"]]:::plan
    PgSelectRows61 --> First60
    PgSelect57 --> PgSelectRows61
    PgSelectSingle62{{"PgSelectSingle[62∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First60 --> PgSelectSingle62
    __InputDynamicScalar64{{"__InputDynamicScalar[64∈0] ➊"}}:::plan
    __InputDynamicScalar64 --> PgFromExpression67
    First68{{"First[68∈0] ➊"}}:::plan
    PgSelectRows69[["PgSelectRows[69∈0] ➊"]]:::plan
    PgSelectRows69 --> First68
    PgSelect65 --> PgSelectRows69
    PgSelectSingle70{{"PgSelectSingle[70∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First68 --> PgSelectSingle70
    __InputDynamicScalar72{{"__InputDynamicScalar[72∈0] ➊"}}:::plan
    __InputDynamicScalar72 --> PgFromExpression75
    First76{{"First[76∈0] ➊"}}:::plan
    PgSelectRows77[["PgSelectRows[77∈0] ➊"]]:::plan
    PgSelectRows77 --> First76
    PgSelect73 --> PgSelectRows77
    PgSelectSingle78{{"PgSelectSingle[78∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First76 --> PgSelectSingle78
    __InputDynamicScalar80{{"__InputDynamicScalar[80∈0] ➊"}}:::plan
    __InputDynamicScalar80 --> PgFromExpression83
    First84{{"First[84∈0] ➊"}}:::plan
    PgSelectRows85[["PgSelectRows[85∈0] ➊"]]:::plan
    PgSelectRows85 --> First84
    PgSelect81 --> PgSelectRows85
    PgSelectSingle86{{"PgSelectSingle[86∈0] ➊<br />ᐸjson_identityᐳ"}}:::plan
    First84 --> PgSelectSingle86
    __InputDynamicScalar88{{"__InputDynamicScalar[88∈0] ➊"}}:::plan
    __InputDynamicScalar88 --> PgFromExpression91
    First92{{"First[92∈0] ➊"}}:::plan
    PgSelectRows93[["PgSelectRows[93∈0] ➊"]]:::plan
    PgSelectRows93 --> First92
    PgSelect89 --> PgSelectRows93
    PgSelectSingle94{{"PgSelectSingle[94∈0] ➊<br />ᐸjsonb_identityᐳ"}}:::plan
    First92 --> PgSelectSingle94
    __InputDynamicScalar96{{"__InputDynamicScalar[96∈0] ➊"}}:::plan
    __InputDynamicScalar96 --> PgFromExpression99
    First100{{"First[100∈0] ➊"}}:::plan
    PgSelectRows101[["PgSelectRows[101∈0] ➊"]]:::plan
    PgSelectRows101 --> First100
    PgSelect97 --> PgSelectRows101
    PgSelectSingle102{{"PgSelectSingle[102∈0] ➊<br />ᐸjsonb_identityᐳ"}}:::plan
    First100 --> PgSelectSingle102
    PgSelect106[["PgSelect[106∈0] ➊<br />ᐸtypesᐳ"]]:::plan
    Object10 --> PgSelect106
    Connection108[["Connection[108∈0] ➊<br />ᐸ106ᐳ"]]:::plan
    PgSelect106 --> Connection108
    ConnectionItems110[["ConnectionItems[110∈0] ➊"]]:::plan
    Connection108 --> ConnectionItems110
    __Item113[/"__Item[113∈3]<br />ᐸ110ᐳ"\]:::itemplan
    ConnectionItems110 ==> __Item113
    PgSelectSingle114{{"PgSelectSingle[114∈3]<br />ᐸtypesᐳ"}}:::plan
    __Item113 --> PgSelectSingle114
    PgClassExpression115{{"PgClassExpression[115∈4]<br />ᐸ__types__.”json”ᐳ"}}:::plan
    PgSelectSingle114 --> PgClassExpression115
    PgClassExpression116{{"PgClassExpression[116∈4]<br />ᐸ__types__.”jsonb”ᐳ"}}:::plan
    PgClassExpression115 o--o PgClassExpression116

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,PgFromExpression11,First12,PgSelectRows13,PgSelectSingle14,PgSelect17,PgFromExpression19,First20,PgSelectRows21,PgSelectSingle22,PgSelect25,PgFromExpression27,First28,PgSelectRows29,PgSelectSingle30,PgSelect33,PgFromExpression35,First36,PgSelectRows37,PgSelectSingle38,PgSelect41,PgFromExpression43,First44,PgSelectRows45,PgSelectSingle46,__InputDynamicScalar48,PgSelect49,PgFromExpression51,First52,PgSelectRows53,PgSelectSingle54,__InputDynamicScalar56,PgSelect57,PgFromExpression59,First60,PgSelectRows61,PgSelectSingle62,__InputDynamicScalar64,PgSelect65,PgFromExpression67,First68,PgSelectRows69,PgSelectSingle70,__InputDynamicScalar72,PgSelect73,PgFromExpression75,First76,PgSelectRows77,PgSelectSingle78,__InputDynamicScalar80,PgSelect81,PgFromExpression83,First84,PgSelectRows85,PgSelectSingle86,__InputDynamicScalar88,PgSelect89,PgFromExpression91,First92,PgSelectRows93,PgSelectSingle94,__InputDynamicScalar96,PgSelect97,PgFromExpression99,First100,PgSelectRows101,PgSelectSingle102,PgSelect106,Connection108,ConnectionItems110 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item113,PgSelectSingle114 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression115,PgClassExpression116 bucket4

